package com.campus.controller;


import com.campus.entity.ResultBody;
import com.campus.mapper.BuildingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BuildingController {


    @Autowired
    private BuildingMapper buildingMapper;
    @RequestMapping("/building/{id}")
    @Cacheable(value = "Building")
    public ResultBody getBuildingName(@PathVariable("id")Integer id){
        return ResultBody.ok().data("building_name",buildingMapper.selectById(id).getBuildingName());
    }
}
